package com.lzw.breezeNovel.webApp.controller.video;

import com.lzw.breezeNovel.common.result.Result;
import com.lzw.breezeNovel.webApp.service.video.CommentLikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 清风明月
 * @Package com.lzw.breezeNovel.webApp.controller.video
 * @date 2025/3/24
 * @description 评论区点赞表
 */
@RestController
@RequestMapping("/app/commentLike")
@SuppressWarnings("all")
public class CommentLikeController {

    /**
     * 评论区点赞的mapper
     */
    @Autowired
    private CommentLikeService commentLikeService;

    /**
     * 点赞评论
     */
    @RequestMapping("/like")
    public Result like(@RequestParam("commentId") Long commentId, @RequestParam("userId") Long userId, @RequestParam("type") Integer type) {
        commentLikeService.like(commentId, userId, type);
        return Result.ok();
    }

    /**
     * 取消点赞
     */
    @RequestMapping("/unlike")
    public Result unlike(@RequestParam("commentId") Long commentId, @RequestParam("userId") Long userId, @RequestParam("type") Integer type) {
        commentLikeService.unlike(commentId, userId, type);
        return Result.ok();
    }

}
